/*Copyright (C) 2013-2021 LZE*/
#include<bits/stdc++.h>
#define INF 0x7fffffff
#define mod 1000000007
#define eps 1e-6
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int N = 1000010;
const int M = 100010;
ll p;
ll exgcd(ll a, ll b, ll &x, ll &y) {
    if(!b) {
        x = 1; y = 0;
        return a;
    }
    ll ret = exgcd(b, a % b, x, y);
    ll t = x;
    x = y;
    y = t - a / b * y;
    return ret;
}
inline ll rd(ll k) {
    int x = 0; bool ntv = false; char c = getchar();
    while((c < '0' || c > '9') && c != '-') c = getchar();
    if(c == '-') ntv = true;
    else x = (c ^ 48);
    c = getchar();
    while(c >= '0' && c <= '9') {
        x = x * 10 + (c ^ 48);
        x = x % k;
        c = getchar();
    }
    return ntv ? -x : x;
}
int main() {
    ll a, b;
    p = 19260817;
    a = rd(p); b = rd(p);
    ll x, y;
    exgcd(b, p, x, y);
    ll inv = (x % p + p) % p;
    printf("%lld\n", a % p * inv % p);
    return 0;
}